home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 21 / CU Amiga Magazine's Super CD-ROM 21 (1998)(EMAP Images)(GB)[!][issue 1998-04].iso / CUCD / Programming / IFF-RGFX / rgfx.h < prev   
Encoding:
C/C++ Source or Header  |  1997-11-26  |  5.6 KB  |  195 lines

  1. /*
  2. **      $VER: rgfx 1.1 (26.11.97)
  3. **
  4. **      Specs and structure definitions for the IFF-RGFX file format -
  5. **
  6. **      (C) Copyright 1997 Andreas R. Kleinert
  7. **      Freeware. All Rights Reserved.
  8. */
  9.  
  10. #ifndef RGFX_H
  11. #define RGFX_H
  12.  
  13. #ifndef EXEC_TYPES_H
  14. #include <exec/types.h>
  15. #endif /* EXEC_TYPES_H */
  16.  
  17. #ifndef LIBARIES_IFFPARSE_H
  18. #include <libraries/iffparse.h>
  19. #endif /* LIBARIES_IFFPARSE_H */
  20.  
  21.  
  22. /* *************************************************** */
  23. /* *                                                 * */
  24. /* * IFF/RGFX specific definitions and declarations  * */
  25. /* *                                                 * */
  26. /* *************************************************** */
  27.  
  28. #define ID_FORM  MAKE_ID('F','O','R','M')  /* if not already defined */
  29. #define ID_RGFX  MAKE_ID('R','G','F','X')  /* IFF-RGFX               */
  30.  
  31. /* A typical structure of a RGFX file (recommended) :
  32.  
  33.      FORM-RGFX
  34.  
  35.        RGHD
  36.        RSCM
  37.        RCOL
  38.        RBOD
  39. */
  40.  
  41.  
  42. /*******************************************************
  43.    RGHD - RawGfx Bitmap Header
  44.  
  45.    ** This one replaces BMHD
  46.  
  47. */
  48.  
  49. #define ID_RGHD  MAKE_ID('R','G','H','D')
  50.  
  51. struct RGHD
  52. {
  53.  ULONG rgfx_LeftEdge;     /* (see BMHD)                               */
  54.  ULONG rgfx_TopEdge;      /* (see BMHD)                               */
  55.  ULONG rgfx_Width;        /* (see BMHD)                               */
  56.  ULONG rgfx_Height;       /* (see BMHD)                               */
  57.  ULONG rgfx_PageWidth;    /* (see BMHD)                               */
  58.  ULONG rgfx_PageHeight;   /* (see BMHD)                               */
  59.  
  60.  ULONG rgfx_Depth;        /* 1-8         for RMBT_BYTEPLANAR8,
  61.                              1-8         for RMBT_BYTECHUNKY8,
  62.                               24         for RMBT_3BYTERGB24          */
  63.  ULONG rgfx_PixelBits;    /* 1-8         for RMBT_BYTEPLANAR8,
  64.                                8         for RMBT_BYTECHUNKY8,
  65.                               24         for RMBT_3BYTERGB24          */
  66.  ULONG rgfx_BytesPerLine; /* (width+7)/8 for RMBT_BYTEPLANAR8,
  67.                               width      for RMBT_BYTECHUNKY8,
  68.                               width*3    for RMBT_3BYTERGB24          */
  69.  
  70.  ULONG rgfx_Compression;  /* RCMP_ type flag                          */
  71.  ULONG rgfx_XAspect;      /* (see BMHD)                               */
  72.  ULONG rgfx_YAspect;      /* (see BMHD)                               */
  73.  ULONG rgfx_BitMapType;   /* RBMT_ type flag                          */
  74. };
  75.  
  76.  /* if you encounter unknown depth/pixelbits/bytesperline combinations,
  77.     then do reject these (future expansions). But so far, only use
  78.     the legal, defines ones yourself ! Don't define own formats,
  79.     e.g. for 16 Bit or for BGR !
  80.   */
  81.  
  82. #define RCMT_NOCOMPRESSION  (0L)
  83. #define RCMT_XPK            (1L)
  84.  
  85. #define RMBT_BYTEPLANAR8    (0L)   /* unaligned planar 8 bit bitmap */
  86. #define RMBT_BYTECHUNKY8    (1L)   /* unaligned chunky 8 bit bitmap */
  87. #define RMBT_3BYTERGB24     (2L)   /* 3-byte 24 bit RGB triples     */
  88. /* ***************************************************** */
  89.  
  90.  
  91. /*******************************************************
  92.    RSCM - RawGfx ScreenMode
  93.  
  94.    ** This one replaces CAMG.
  95.  
  96.    The default setting is:
  97.  
  98.    rscm_AGA:  default screenmode
  99.    rscm_CGfx: INVALID_ID
  100.    rscm_P96:  INVALID_ID
  101.  
  102.    if ModeNotAvailable( rscm_P96 ) does return an error,
  103.    then try ModeNotAvailable( rscm_CGfx ) - on error,
  104.    then try ModeNotAvailable( rscm_AGA ).
  105.  
  106.    Use the first ID, which is available, otherwise compute
  107.    one yourself by using BestModeID()
  108. */
  109.  
  110. #define ID_RSCM  MAKE_ID('R','S','C','M')
  111.  
  112. struct RSCM
  113. {
  114.  ULONG rscm_AGA;  /* 32 Bit AGA  Viewmode ID */
  115.  ULONG rscm_CGfx; /* 32 Bit CGfx Viewmode ID */
  116.  ULONG rscm_P96;  /* 32 Bit P96  Viewmode ID */
  117. };
  118. /* ***************************************************** */
  119.  
  120.  
  121. /*******************************************************
  122.    RCOL - RawGfx Colormap
  123.  
  124.    ** This one replaces CMAP,
  125.  
  126.       Required with RMBT_BYTEPLANAR8 and RMBT_BYTECHUNKY8,
  127.       and optionally allowed with RMBT_3BYTERGB24 for use
  128.       as a dithering destination colormap.
  129.  
  130.       Stored are 256 byte triples in RGB format. Note, that
  131.       full-range values (0..255) have to be stored.
  132.  
  133.       Sample:   rcol_Colors[0][0]   = 0..255 red   value, color #0 (1st)
  134.                 rcol_Colors[0][1]   = 0..255 green value, color #0
  135.                 rcol_Colors[0][2]   = 0..255 blue  value, color #0
  136.                 ...
  137.                 rcol_Colors[255][0] = 0..255 red   value, color #255 (256th)
  138.                 rcol_Colors[255][1] = 0..255 green value, color #255
  139.                 rcol_Colors[255][2] = 0..255 blue  value, color #255
  140.  
  141.  
  142.       Unused entries should be filled with zeroes.
  143. */
  144.  
  145. #define ID_RCOL  MAKE_ID('R','C','O','L')
  146.  
  147. struct RCOL
  148. {
  149.  ULONG rcol_TransColor;      /* boolean: is there a transparent color ?  */
  150.  ULONG rcol_TransColorNum;   /* yes, it's number ... from the ones below */
  151.  UBYTE rcol_Colors[256][3];
  152. };
  153. /* ***************************************************** */
  154.  
  155.  
  156. /*******************************************************
  157.    RBOD - RawGfx Bitmap Body
  158.  
  159.    ** This one replaces BODY
  160. */
  161.  
  162. #define ID_RBOD  MAKE_ID('R','B','O','D')
  163.  
  164. /* May look like:
  165.  
  166. struct RBOD
  167. {
  168.  UBYTE rbod_XPK[3];     ** containing 'XPK'
  169.  UBYTE rbod_BitMap[];
  170. };
  171.  
  172.    Or simply:
  173.  
  174. struct RBOD
  175. {
  176.  UBYTE rbod_BitMap[];
  177. };
  178.  
  179.  This has not been defined as a union structure here, since some
  180.  compilers might add unwished pad bytes to the structure.
  181.  
  182.  You should reference this chunk as an UBYTE array, only.
  183.  
  184.  ******************************************************* */
  185.  
  186.  
  187. /*******************************************************
  188.    RGFX - Other chunks
  189.  
  190.    - NAME, AUTH, ANNO and (C) chunks are allowed
  191.    -
  192. ******************************************************** */
  193.  
  194. #endif /* RGFX_H */
  195.